import java.util.Scanner;

class Account{
    private final int value =123456;
    private final String name = "hehaohao";
    public int count = 2;
    public boolean enrol(String name,int value){
        if(this.count==0){
            System.out.println("已经没有机会了");
            return false;
        }
        boolean i = this.value!=value || !this.name.equals(name) ? false : true;
        if(!i){
            System.out.println("用户名或密码错误，还有"+this.count+"次机会");
            this.count--;
            return true;
        }else{
            System.out.println("成功登入");
            return false;
        }
    }
}
public class Test3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Account a = new Account();
        System.out.println("请输入用户名和密码：");
        while(a.enrol(sc.next(),sc.nextInt()));
    }
}
